package com.pan.studentmaster;

import android.database.Cursor;

public class Student {
	
	static public Student instance() {
		if(_instance == null) {
			Cursor c = DB.instance().getStudent();
			if(!c.isAfterLast()) {
				_instance = new Student();
				_instance._id = c.getInt(c.getColumnIndex(DB.STUDENT._ID));
				_instance._school = c.getString(c.getColumnIndex(DB.STUDENT._SCHOOL));
				_instance._grade = c.getInt(c.getColumnIndex(DB.STUDENT._GRADE));
				_instance._class = c.getString(c.getColumnIndex(DB.STUDENT._CLASS));
				_instance._number = c.getInt(c.getColumnIndex(DB.STUDENT._NUMBER));
				_instance._name = c.getString(c.getColumnIndex(DB.STUDENT._NAME));
			}
			c.close();
		}
		return _instance;
	}
	
	public int		getID() { return _id; }
	public String	getSchool() { return _school; }
	public int		getGrade() { return _grade; }
	public String	getClassA() {	return _class; }
	public int		getNumber() { return _number; }
	public String	getName() { return _name; }
	
	// private

	static private Student	_instance = null;
	private int				_id;
	private String			_school;
	private int				_grade;
	private String			_class;
	private int				_number;
	private String			_name;
	
	private Student() {
	}

}
